package home.contaduria.dao.jpa;

import home.contaduria.dao.ClientDao;
import home.contaduria.domain.Client;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Repository;

@Repository("clientDaoJpaImpl")
public class ClientDaoJpaImpl extends GenericDaoJpaImpl<Client, Long> implements ClientDao {

	@Override
	public Client loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException {
		return getEntityManager().createNamedQuery("Client.loadUserByUsername", Client.class)
				.setParameter("login", login).getSingleResult();
	}

}
